'''
官方文档: https://docs.python.org/zh-cn/3.7/library/multiprocessing.html
'''
from multiprocessing import Process
import time


def func(name=""):
    print(f"hello process!{name}\n")
    time.sleep(3)  # 暂停10s
    print(f"{name} end!\n")


def run_process():
    p1 = Process(target=func, args=("进程1",))
    p2 = Process(target=func, args=("进程2",))
    p3 = Process(target=func, args=("进程3",))
    # start
    p1.start()
    p2.start()
    p3.start()
    # join
    # p1.join()
    # p2.join()
    # p3.join()


if __name__ == "__main__":
    run_process()
    print("主线程执行！")
